package com.jincheng.springblog.mapper;

import com.jincheng.springblog.model.BlogInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BlogMapper {

    @Select("select * from blog where delete_flag = 0")
    List<BlogInfo> selectAll();

    @Select("select * from blog where id = #{id}")
    BlogInfo selectById(Integer id);

    Integer updateBlog(BlogInfo blogInfo);

    @Insert("insert into blog (title, content, user_id) values (#{title}, #{content}, #{userId})")
    Integer insertBlog(BlogInfo blogInfo);
}
